package com.game.util;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

/**
 * 图片资源加载器
 */
public class ImageLoader {
	public static Toolkit tk = Toolkit.getDefaultToolkit();
	public static Image getImgByPath(String path){
		try {
			return tk.getImage(URLDecoder.decode(ImageLoader.class.
					getClassLoader().getResource(path).getFile(),"UTF-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return null;
	}
}
